/*
 * (C) Copyright 2013 George Daswani (georgedaswani@gmail.com) and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * Contributors:
 *    George Daswani (georgedaswani@gmail.com)
 */

package am.internal;

import com.sun.jna.Library;

public interface AMLibrary extends Library {

	int AmCleanup();

	int AmClearLastError(int connHandle);

	int AmCloseConnection(int connHandle);

	int AmCommit(int connHandle);

	int AmConnectionName(int connHandle, byte[] buffer, int bufferLen);

	int AmConvertDateBasicToUnix(int hApiCnxBase, int tmTime);

	int AmConvertDateIntlToUnix(int hApiCnxBase, String strDate);

	int AmConvertDateStringToUnix(int hApiCnxBase, String strDate);

	int AmConvertDateUnixToBasic(int hApiCnxBase, int lTime);

	int AmConvertDateUnixToIntl(int hApiCnxBase, int lUnixDate, byte[] strDate,
			int lDate);

	int AmConvertDateUnixToString(int hApiCnxBase, int lUnixDate,
			byte[] strDate, int lDate);

	int AmConvertDoubleToString(double dSrc, byte[] strDst, int lDst);

	int AmConvertMonetaryToString(double dSrc, byte[] strDst, int lDst);

	double AmConvertStringToDouble(String strSrc);

	double AmConvertStringToMonetary(String strSrc);

	int AmCreateLink(int hApiRecord, String strLinkName, int hApiRecDest);

	int AmCreateRecord(int hApiCnxBase, String strTable);

	int AmCurrentDate();

	int AmCurrentServerDate(int hApiCnxBase);

	int AmDateAdd(int tmStart, int tsDuration);

	int AmDateAddLogical(int tmStart, int tsDuration);

	int AmDateDiff(int tmEnd, int tmStart);

	int AmDbExecAql(int hApiCnxBase, String strAqlStatement);

	int AmDbGetDate(int hApiCnxBase, String strQuery);

	int AmDbGetDouble(int hApiCnxBase, String strQuery);

	int AmDbGetLimitedList(int hApiCnxBase, String strQuery, byte[] pstrResult,
			int lResult, String strColSep, String strLineSep, String strIdSep,
			int lMaxSize, int lErrorType);

	int AmDbGetList(int hApiCnxBase, String strQuery, byte[] strResult,
			int lResult, String strColSep, String strLineSep, String strIdSep);

	int AmDbGetListEx(int hApiCnxBase, String strQuery, byte[] strResult,
			long lResult, String strColSep, String strLineSep, String strIdSep);

	int AmDbGetLong(int hApiCnxBase, String strQuery);

	int AmDbGetPk(int hApiCnxBase, String strTableName, String strWhere);

	int AmDbGetString(int hApiCnxBase, String strQuery, byte[] strResult,
			int lResult, String strColSep, String strLineSep);

	int AmDbGetStringEx(int hApiCnxBase, String strQuery, byte[] pstrResult,
			long lResult, String strColSep, String strLineSep);

	int AmDeleteLink(int hApiRecord, String strLinkName, int hApiRecDest);

	int AmDeleteRecord(int hApiRecord);

	int AmDuplicateRecord(int hApiRecord, int bInsert);

	int AmEnumValList(int hApiCnxBase, String strEnumName, byte[] pstrValList,
			int lValList, int bNoCase, String strLineSep);

	int AmExecuteActionById(int hApiCnxBase, int lActionId,
			String strTableName, int lRecordId);

	int AmExecuteActionByName(int hApiCnxBase, String strSqlName,
			String strTableName, int lRecordId);

	int AmExportDocument(int hApiCnxBase, int lDocId, String strFileName);

	int AmFlushTransaction(int hApiCnxBase);

	int AmFormatCurrency(double dAmount, String strCurrency, byte[] strDisplay,
			int lDisplay);

	int AmFormatLong(int hApiCnxBase, int lNumber, String strFormat,
			byte[] strResult, int lResult);

	int AmGetComputeString(int hApiCnxBase, String strTableName, int lRecordId,
			String strTemplate, byte[] strComputeString, int lComputeString);

	int AmGetField(int hApiObject, long lPos);

	int AmGetFieldCount(int hApiObject);

	int AmGetFieldDateOnlyValue(int hApiObject, int lFieldPos);

	int AmGetFieldDateValue(int hApiObject, int lFieldPos);

	int AmGetFieldDescription(int hApiField, byte[] strBuffer, int lBuffer);

	double AmGetFieldDoubleValue(int hApiObject, int lFieldPos);

	int AmGetFieldFormat(int hApiField, byte[] strBuffer, int lBuffer);

	int AmGetFieldFormatFromName(int hApiCnxBase, String strTableName,
			String strFieldName, byte[] fieldFormat, int pFieldFormat);

	int AmGetFieldFromName(int hApiObject, String strName);

	int AmGetFieldLabel(int hApiField, byte[] strBuffer, long lBuffer);

	int AmGetFieldLabelFromName(int hApiCnxBase, String strTableName,
			String strFieldName, byte[] fieldLabel, int lFieldLabel);

	int AmGetFieldLongValue(int hApiObject, int lFieldPos);

	int AmGetFieldName(int hApiObject, int lFieldPos, byte[] strBuffer,
			int lBuffer);

	int AmGetFieldSize(int hApiField);

	int AmGetFieldSqlName(int hApiField, byte[] strBuffer, int lBuffer);

	int AmGetFieldStrValue(int queryHandle, int position, byte[] target,
			int targetLength);

	int AmGetFieldType(int hApiField);

	int AmGetFieldUserType(int hApiField);

	int AmGetRecordHandle(int qryHandle);

	int AmGetRecordId(int hApiRecord);

	int AmGetRecordFromMainId(int hApiCnxBase, String strTableName, int lId);

	int AmGetRelDstField(int hApiField);

	int AmGetRelSrcField(int hApiField);

	int AmGetReverseLink(int hApiField);

	int AmGetSelfFromMainId(int hApiCnxBase, String strTableName, int lId,
			byte[] strRecordDesc, int lRecordDesc);

	int AmGetVersion(byte[] strBuf, int lBuf);

	int AmImportDocument(int hApiCnxBase, int lDocObjId, String strTableName,
			String strFileName, String strCategory, String strDesignation);

	int AmInsertRecord(int hApiRecord);

	int AmIsConnected(int hApiCnxBase);

	int AmLastError(int hApiCnxBase);

	int AmLastErrorMsg(int hApiCnxBase, byte[] strBuffer, int lBuffer);

	int AmListToString(byte[] returnStr, int lreturn, String strSource,
			String strColSep, String strLineSep, String strIdSep);

	int AmLoginId(int hApiCnxBase);

	int AmLoginName(int hApiCnxBase, byte[] returnStr, int lreturn);

	int AmOpenConnection(String src, String user, String password);

	int AmPurgeRecord(int hApiRecord);

	int AmQueryCreate(int connHandle);

	int AmQueryExec(int qryHandle, String aqlQuery);

	int AmQueryGet(int qryHandle, String aqlQuery);

	int AmQueryNext(int qryHandle);

	int AmQuerySetAddMainField(int hApiQuery, int bAddMainField);

	int AmQuerySetFullMemo(int hApiQuery, int bFullMemo);

	int AmQueryStartTable(int hApiQuery);

	int AmQueryStop(int qryHandle);

	int AmRefreshAllCaches(int hApiCnxBase);

	int AmReleaseHandle(int qryHandle);

	int AmRollback(int hApiCnxBase);

	int AmSetFieldDateOnlyValue(int hApiRecord, String strFieldName,
			int dtptmValue);

	int AmSetFieldDateValue(int hApiRecord, String strFieldName, int tmValue);

	int AmSetFieldDoubleValue(int hApiRecord, String strFieldName, double dValue);

	int AmSetFieldLongValue(int hApiRecord, String strFieldName, int lValue);

	int AmSetFieldStrValue(int hApiRecord, String strFieldName, String strValue);

	int AmSqlTextConst(byte[] returnStr, int lreturn, String str);

	int AmStartTransaction(int connHandle);

	void AmStartup();

	int AmUpdateRecord(int recHandle);

}
